#本例演示如何生成lib文件
cmake_minimum_required(VERSION 2.8)
project(make-lib-cpp)



# 生成一个静态库，会生成一个libhello.a文件
#add_library(fun fun.cpp )
include_directories(${PROJECT_SOURCE_DIR})
AUX_SOURCE_DIRECTORY(${PROJECT_SOURCE_DIR} src_list)

message("src_list-----------:${src_list}")
# 生成一个共享库，会生成一个libhello_shared.so文件
#add_library(july_cpp SHARED adapter.h ${src_list})

add_library(july_cpp SHARED ${src_list})

#拷贝头文件
file(COPY ${PROJECT_SOURCE_DIR}/adapter.h DESTINATION
    ${PROJECT_SOURCE_DIR}/../lib-cpp)

file(COPY ${PROJECT_SOURCE_DIR}/july_cpp.h DESTINATION
    ${PROJECT_SOURCE_DIR}/../lib-cpp)

#指定生成的库文件存放目录
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../lib-cpp)
#本地运行
set(lib_path ${CMAKE_SOURCE_DIR}/../lib-cpp)

#添加头文件搜索路径
include_directories(${lib_path})

add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME}
    ${lib_path}/libjuly_cpp.dll)
